// pages/list/list.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    keyword: '',
    no: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;

    wx.request({
      url: 'https://xcxu.we-fs.com/index.php/api/goods/checkcollect?openid=' + app.globalData.openid,
      success: function (res) {
        console.log(res)
        if (res.data.status == 0){
          if (res.data.data.length > 0) {
            that.setData({
              items: res.data.data,
              no: false
            })
          } else {
            that.setData({
              items: [],
              no: true
            })
          }
        }else{
          that.setData({
            items: [],
            no: true
          })
        }
        
      }
    })
  },
  goodsClick(e) {
    wx.navigateTo({
      url: '../../pages/goods/goods?id=' + e.currentTarget.dataset.id,
    })
  }

})